///*
// * Copyright 2013-2015 the original author or authors.
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// *      http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//package com.xdtech.jmax.demo.init;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import com.xdtech.common.service.impl.BaseService;
//import com.xdtech.common.utils.encrypt.DESCoder;
//import com.xdtech.core.init.SysInitOperation;
//import com.xdtech.core.model.BaseModel;
//import com.xdtech.forum.model.Article;
//import com.xdtech.forum.model.Category;
//import com.xdtech.forum.model.CommentInfo;
//import com.xdtech.forum.model.LinkTag;
//import com.xdtech.forum.model.Member;
//import com.xdtech.forum.service.ArticleService;
//import com.xdtech.forum.service.CategoryService;
//import com.xdtech.forum.service.CommentInfoService;
//import com.xdtech.forum.service.LinkTagService;
//import com.xdtech.forum.service.MemberService;
//import com.xdtech.sys.model.CodeValue;
//import com.xdtech.sys.model.DictionaryCode;
//import com.xdtech.sys.model.MenuFunction;
//
///**
// * 
// * @author max.zheng
// * @create 2015-4-4下午1:30:07
// * @since 1.0
// * @see
// */
//public class JmaxDemoInit implements SysInitOperation{
//
//	/**
//	 * @description
//	 * @author max.zheng
//	 * @create 2015-4-4下午1:30:46
//	 * @modified by
//	 * @param baseService
//	 */
//	@Override
//	public void initingToDb(BaseService<BaseModel> baseService) {
//		MenuFunction m4 = new MenuFunction();
//		m4.setIconName("icon-project");
//		m4.setNameCN("案例演示");
//		m4.setOperationCode("codecreater-manage");
//		baseService.save(m4);
//		
//		MenuFunction m41 = new MenuFunction();
//		m41.setIconName("icon-score");
//		m41.setNameCN("商城管理");
//		m41.setOperationCode("shop-manage");
//		m41.setParent(m4);
//		baseService.save(m41);
//		
//		MenuFunction m42 = new MenuFunction();
//		m42.setIconName("icon-forum");
//		m42.setNameCN("论坛管理");
//		m42.setOperationCode("forum-manage");
//		m42.setParent(m4);
//		baseService.save(m42);
//		
//		MenuFunction m421 = new MenuFunction();
//		m421.setIconName("icon-category");
//		m421.setNameCN("帖子类别");
//		m421.setOperationCode("category-manage");
//		m421.setPageUrl("category.do?category");
//		m421.setParent(m42);
//		baseService.save(m421);
//		
//		MenuFunction m422 = new MenuFunction();
//		m422.setIconName("icon-article");
//		m422.setNameCN("帖子管理");
//		m422.setOperationCode("article-manage");
//		m422.setPageUrl("article.do?article");
//		m422.setParent(m42);
//		baseService.save(m422);
//		MenuFunction m423 = new MenuFunction();
//		m423.setIconName("icon-member");
//		m423.setNameCN("会员管理");
//		m423.setOperationCode("member-manage");
//		m423.setPageUrl("member.do?member");
//		m423.setParent(m42);
//		baseService.save(m423);
//		
//		MenuFunction m424 = new MenuFunction();
//		m424.setIconName("icon-save");
//		m424.setNameCN("快捷标签");
//		m424.setOperationCode("quick-tag");
//		m424.setPageUrl("linkTag.do?linkTag");
//		m424.setParent(m42);
//		baseService.save(m424);
//		
//		MenuFunction m425 = new MenuFunction();
//		m425.setIconName("icon-comment-info");
//		m425.setNameCN("评论管理");
//		m425.setOperationCode("comment-manage");
//		m425.setPageUrl("commentInfo.do?commentInfo");
//		m425.setParent(m42);
//		baseService.save(m425);
//		
//		MenuFunction m426 = new MenuFunction();
//		m426.setIconName("icon-portal");
//		m426.setNameCN("论坛门户");
//		m426.setOperationCode("forum-look");
//		m426.setPageUrl("portal.action?index");
//		m426.setIframe(true);
//		m426.setParent(m42);
//		baseService.save(m426);
//		
//		MenuFunction m43 = new MenuFunction();
//		m43.setIconName("icon-save");
//		m43.setNameCN("运输管理");
//		m43.setOperationCode("tran-manage");
//		m43.setParent(m4);
//		baseService.save(m43);
//		
//		MenuFunction m431 = new MenuFunction();
//		m431.setIconName("icon-save");
//		m431.setNameCN("订单管理");
//		m431.setOperationCode("tran-order-manage");
//		m431.setPageUrl("tranOrder.do?tranOrder");
//		m431.setParent(m43);
//		baseService.save(m431);
//		
//		MenuFunction m432 = new MenuFunction();
//		m432.setIconName("icon-save");
//		m432.setNameCN("司机管理");
//		m432.setOperationCode("tran-driver-manage");
//		m432.setPageUrl("tranDriver.do?tranDriver");
//		m432.setParent(m43);
//		baseService.save(m432);
//		
//		Member member = new Member();
//		member.setName("max");
//		member.setNickName("max");
//		member.setEmail("123456@qq.com");
//		member.setPassword(DESCoder.encrypt("123456"));
//		member.setSex("M");
//		baseService.save(member);
//		List entities = new ArrayList<Category>();
//		entities.add(new Category("1","问题反馈","fa-file-text"));
//		entities.add(new Category("2","平台交流","fa-bell-o"));
//		baseService.saveAll(entities);
//		
//		List linkTags = new ArrayList<LinkTag>();
//		//关键字创建
//		linkTags.add(new LinkTag("java", "1", "", ""));
//		linkTags.add(new LinkTag("jmax", "1", "", ""));
//		linkTags.add(new LinkTag("前端", "1", "", ""));
//		linkTags.add(new LinkTag("极速开发平台", "1", "", ""));
//		//友情链接地址
//		linkTags.add(new LinkTag("百度", "2", "http://www.baidu.com", ""));
//		linkTags.add(new LinkTag("个人博客", "2", "http://java4ever.iteye.com", ""));
//		//联系
//		linkTags.add(new LinkTag("QQ", "3", "", "webpages/forum/portal/images/max.jpg"));
//		//广告
//		linkTags.add(new LinkTag("广告", "4", "http://www.baidu.com", "webpages/forum/portal/images/max.jpg"));
//		baseService.saveAll(linkTags);
//		
//		Article article = new Article("JMax快速开发平台","JMax由java开发，基于spring+hibernate+easyui整合的一套综合从前端到后端一体化框架,UI自定义封装，方便用户快捷使用，sql模版自定义，灵活配置，代码自动速成，一键开发，图表配置，立即预览",new Category(2L));
//		article.setIsHot("true");
//		article.setIcon("webpages/forum/portal/images/jmax-home.png");
//		article.setMember(new Member(1L));
//		baseService.save(article);
//		
//		article = new Article("报表图表","根据配置的sql和xml，自动完成报表导出和图表显示功能。",new Category(1L));
//		article.setIsHot("true");
//		article.setMember(new Member(1L));
//		baseService.save(article);
//		
//		CommentInfo commentInfo = new CommentInfo();
//		commentInfo.setContent("好东西，赞一个，支持开源");
//		commentInfo.setMember(member);
//		commentInfo.setArticle(article);
//		baseService.save(commentInfo);
//		
//		//数据字典
//		DictionaryCode dictionaryCode = new DictionaryCode("FORUM_LINK_TAG_TYPE","快捷链接类型");
//		baseService.save(dictionaryCode);
//		baseService.save(new CodeValue("1","关键字",1,dictionaryCode));
//		baseService.save(new CodeValue("2","友情链接",2,dictionaryCode));
//		baseService.save(new CodeValue("3","联系",3,dictionaryCode));
//		baseService.save(new CodeValue("4","广告",4,dictionaryCode));
//		
//	}
//
//	/**
//	 * @description
//	 * @author max.zheng
//	 * @create 2015-4-4下午1:30:46
//	 * @modified by
//	 * @param baseService
//	 */
//	@Override
//	public void initingToCache(BaseService<BaseModel> baseService) {
//		// TODO Auto-generated method stub
//		
//	}
//
//	/**
//	 * @description
//	 * @author max.zheng
//	 * @create 2015-4-4下午4:35:58
//	 * @modified by
//	 * @return
//	 */
//	@Override
//	public int getInitOrder() {
//		// TODO Auto-generated method stub
//		return 999;
//	}
//
//}
